package com.bj.zspace.cat.controller;

import com.dianping.cat.Cat;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:liuwenqing
 * @Date:2024/12/5 22:01
 * @Description:
 **/
@RestController
public class TraceTest {

    @GetMapping(value = "/trace")
    public String trace() {
        // 只有transaction类型的才会判断是否是原子message,其他类型的都是原子类的消息
        Transaction transaction = Cat.newTransaction("trace", "trace_name");
        Cat.getManager().setTraceMode(true);
        Cat.logTrace("trace", "trace_name");
        transaction.setStatus(Message.SUCCESS);
        transaction.complete();
        return "ok";

    }

}
